-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
*: get tiflash http(s) port from tiflash status port instead of etcd #30901
*: get tiflash http(s) port from tiflash status port instead of etcd #30901
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/cc @crazycs520 @windtalker PTAL |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/3f78a2807fa7af96097359d89a6d1d0fbb638dbc |
/run-unit-test |
@CalvinNeo: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
@lidezhu: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
} | ||
info.ResolveLoopBackAddr() | ||
if len(tiflashInstances) > 0 && !tiflashInstances.Exist(info.Address) { | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
append a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiflashInstances
is just the where clause in the select list.
For example, if the sql is select * from tiflash_tables
, then tiflashInstances
is empty and it means we need to select the info for all tiflash nodes in the cluster.
If the sql is select * from tiflash_tables where tiflash_instance='127.0.0.1:9000'
, then tiflashInstances
contains the element 127.0.0.1:9000
and we need filter out other tiflash nodes.
if err != nil { | ||
sctx.GetSessionVars().StmtCtx.AppendWarning(err) | ||
continue | ||
} | ||
if resp.StatusCode != http.StatusOK { | ||
return errors.Errorf("request %s failed: %s", configURL, resp.Status) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should append warning or return error first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If tiflash doesn't return response, it means the tiflash node is down or is network partitioned, we can safely ignore the tiflash node and just append warning.
But if tiflash can return response, but the status code is not StatusOK
, then something bad unknown must happen and an error is perfered to remind this case.
what if tiflash config has errors of format? like 127...0.0:2222222 |
The config read from tiflash status port is already checked by tiflash instance. If the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
This pull request has been accepted and is ready to merge. Commit hash: cfbad4e
|
@lidezhu: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/rebuild |
/merge |
@lidezhu: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
What problem does this PR solve?
Issue Number: close #xxx
Problem Summary: There are two system tables about tiflash in tidb that need to read data from tiflash http(s) port. Previously tidb get http(s) port from etcd which was reported by tiflash. But from v5.3, we can get tiflash config from tiflash status port and so we can parse the http(s) port from the config instead of etcd.
What is changed and how it works?
The system tables' behavior remains the same as in #18092 and #19714.
The only difference is that we get http(s) port from the config fetched from tiflash status port instead of etcd.
The detailed steps are as following:
tiflash_proxy_status_port
for every tiflash instance;{tiflash_host}:{tiflash_proxy_status_port}/config
;http_port
orhttps_port
from the config itemsengine-store.http_port
orengine-store.https_port
;Check List
Tests
deploy a tidb cluster and check we can select from the two tiflash system tables
tiflash_segments
andtiflash_tables
as before.Release note